/***************************************************************************
创建者：华磊
 开始时间：               : 2020.1１.09
 copyright            : (C) 深圳市华友高科有限公司
 修改说明：（每次有修改就添加一条，带有 修改人，修改时间，修改描述）

 ***************************************************************************
 *   顶部视窗对话框
*                                                                         *
 ***************************************************************************/
#include "controlmode.h"
#include "ui_controlmode.h"
#include "topview.h"
#include "hmicommondefine.h"
#include "instructionEnum.h"


ControlMode::ControlMode(QWidget *parent) :
    QWidget(parent),
    ui(new Ui::ControlMode)
{
    ui->setupUi(this);
    setAttribute(Qt::WA_QuitOnClose, false);
}

ControlMode::~ControlMode()
{
    delete ui;
}

void ControlMode::updateCurrentModelData()
{
    if(topView->controlMode == EM_CONTROL_MODE_T1)
    {
        ui->radioButton->setChecked(true);
        ui->radioButton_2->setChecked(false);
        ui->radioButton_3->setChecked(false);
        ui->radioButton_4->setChecked(false);
    }
    else if(topView->controlMode == EM_CONTROL_MODE_T2)
    {
        ui->radioButton->setChecked(false);
        ui->radioButton_2->setChecked(true);
        ui->radioButton_3->setChecked(false);
        ui->radioButton_4->setChecked(false);
    }
    else if(topView->controlMode == EM_CONTROL_MODE_AUTO)
    {
        ui->radioButton->setChecked(false);
        ui->radioButton_2->setChecked(false);
        ui->radioButton_3->setChecked(true);
        ui->radioButton_4->setChecked(false);
    }
    else if(topView->controlMode == EM_CONTROL_MODE_EXT)
    {
        ui->radioButton->setChecked(false);
        ui->radioButton_2->setChecked(false);
        ui->radioButton_3->setChecked(false);
        ui->radioButton_4->setChecked(true);
    }
    else
    {}
}

void ControlMode::changeLanguage()
{
    ui->retranslateUi(this);
}

void ControlMode::on_radioButton_clicked()
{
    emit controlMaunal1Mode();
    topView->updateControlModeView();
}

void ControlMode::on_radioButton_2_clicked()
{
    emit controlMaunal2Mode();
    topView->updateControlModeView();
}

void ControlMode::on_radioButton_3_clicked()
{
    emit controlAutoMode();
    topView->updateControlModeView();
}

void ControlMode::on_radioButton_4_clicked()
{
    emit controlExtraMode();
    topView->updateControlModeView();
}

void ControlMode::on_FleetMode_Btn_clicked()
{
    emit controlFleetMode();
    topView->updateControlModeView();
}
